﻿#region License
// (c) Intergen.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using MediaWiki.Office.Model.Utilities;

namespace MediaWiki.Office.Model
{
  public class TabStop
  {
    private string _leader;
    private Unit _position;
    private TabStopType _type;

    public TabStopType Type
    {
      get { return _type; }
      set { _type = value; }
    }

    public Unit Position
    {
      get { return _position; }
      set { _position = value; }
    }

    public string Leader
    {
      get { return _leader; }
      set { _leader = value; }
    }

    public TabStop()
    {
    }

    public TabStop(XElement element)
    {
      if (element == null)
        throw new ArgumentNullException("element");

      _type = XmlUtils.GetValue<TabStopType>(element).Value;
      _position = Unit.Twip(XmlUtils.GetValue<int>(element, "pos")).Value;
      _leader = XmlUtils.GetValue(element, "leader");
    }
  }
}
